import java.lang.ref.WeakReference;

/**
 * @author 龙小虬
 * @date 2021/4/14 23:06
 */
public class WeakReferencesTest {
    public static void main(String[] args) {
        Entity user1 = new Entity("lxq");
        WeakReference<Entity> user2 = new WeakReference<Entity>(user1);
        user1 = null;
        System.gc();
        System.out.println(user2.get());
    }
}
